#ifndef ENEMY_H
#define ENEMY_H

#include "Character.h"
#include <random>

// Base enemy class
class Enemy : public Character {
protected:
    int experienceReward; // Experience points gained when defeating the enemy
    
public:
    // Constructor
    Enemy(const std::string& name, const std::string& desc, 
          unsigned health, unsigned attack, unsigned defense,
          int expReward = 0);
    
    // Get experience reward
    int getExperienceReward() const;
    
    // Enemy attack behavior
    virtual bool attack(ICharacter& target) override;
    
    // Operator overloading - use + to represent attack
    virtual bool operator+(ICharacter& target);
};

// Goblin subclass - sometimes performs critical hits
class Goblin : public Enemy {
private:
    float criticalChance; // Critical hit chance
    
public:
    Goblin(const std::string& name, const std::string& desc, 
           unsigned health, unsigned attack, unsigned defense,
           int expReward = 0, float critChance = 0.2f);
    
    // Special attack implementation - chance to critical hit
    bool attack(ICharacter& target) override;
};

// Ghost subclass - chance to dodge damage
class Ghost : public Enemy {
private:
    float dodgeChance; // Dodge chance
    
public:
    Ghost(const std::string& name, const std::string& desc, 
          unsigned health, unsigned attack, unsigned defense,
          int expReward = 0, float evadeChance = 0.3f);
    
    // Override takeDamage method, implementing dodge ability
    bool takeDamage(unsigned damage) override;
};

// BOSS subclass - has healing abilities and powerful attacks
class Boss : public Enemy {
private:
    bool enraged;      // Whether in enraged state
    unsigned healPower; // Healing power
    
public:
    Boss(const std::string& name, const std::string& desc, 
         unsigned health, unsigned attack, unsigned defense,
         int expReward = 0, unsigned heal = 2);
    
    // Special attack implementation
    bool attack(ICharacter& target) override;
    
    // BOSS can recover some health when severely injured
    bool takeDamage(unsigned damage) override;
};

#endif // ENEMY_H 